clear
macro drop _all 
set more off

* specify where structural estimation sample is saved
global direc_sample "..."

* import data
import delimited "${direc_sample}/estimation_sample.csv", clear

* Step 1: Create a variable to specify the number of replications
gen replications = n_insurers if major_ist == 0
replace replications = 1 if major_ist == 1

* Step 2: Use the expand command to replicate the rows
expand replications
drop replications

reghdfe prem_ipst iv_prem_insurer_nstate , a(naic_code report_year) cluster(naic_code)
